 //-----------------------------标签切换--------------------							

function setTab(m,n){
	  var menu=document.getElementById("tab"+m).getElementsByTagName("li"); 
	  var showdiv=document.getElementById("tab_cont"+m).getElementsByTagName("ul");  
	  for(i=0;i<menu.length;i++)
	  {
		  menu[i].className=i==n?"current":"";   
		  showdiv[i].style.display=i==n?"block":"none";  
		  }
  } 












 $(document).ready(function(){

 //-----------------------------文字滚动---------------------

  function AutoScroll(){
	$("#scrollDt").find("ul:first").animate({
		marginTop:"-20px"
	},1000,function(){
		$(this).css({marginTop:"0px"}).find("li:first").appendTo(this);
	});
};
setInterval(AutoScroll,3000);


 
 //-----------------------------焦点图轮播--------------------- 

var t = n = 0, count = $("#playShow a").size();
	$("#playShow a:not(:first-child)").hide();
	$("#playText").html($("#playShow a:first-child").find("img").attr('alt'));
	$("#playNum a:first").addClass("num_current");
	$("#playText").click(function(){window.open($("#playShow a:first-child").attr('href'), "_blank")});
	$("#playNum a").mousemove(function() {
	   var i = $(this).text() - 1;
	   n = i;
	   if (i >= count) return;
	   $("#playText").html($("#playShow a").eq(i).find("img").attr('alt'));
	   $("#playText").unbind().click(function(){window.open($("#playShow a").eq(i).attr('href'), "_blank")})
	   $("#playShow a").filter(":visible").hide().parent().children().eq(i).show();
	   $(this).addClass("num_current").siblings().removeClass("num_current");
	});
	t = setInterval(showAuto, 5000);
	$("#play").hover(function(){clearInterval(t)},
					function(){t = setInterval(showAuto, 5000);});
	
	function showAuto()
	{
		n = n >= (count - 1) ? 0 : ++n;
		$("#playNum a").eq(n).trigger('mousemove');
	} 
 
  
  //---------------------左右轮播------------------
var page = 1;
var i = 1; //每版放1个li
    //向后 按钮
    $(".lr .next").click(function(){    
	      var $parent = $(this).parents(".lr");
		 var $v_show = $parent.find(".scrollGy");
		 var $v_content = $parent.find(".v_cont");
		 var v_width = $v_content.width();
		 var len = $v_show.find("li").length;
		 var page_count = Math.ceil(len / i) ;  
		  if( !$v_show.is(":animated") ){    
			  if( page == page_count ){  
				$(this).stop(); 
				}else{
				$v_show.animate({ left : '-='+v_width }, 1000);  //通过改变left值，达到每次换一个版面
				page++;
			 }
		 }
   });
		
    //往前 按钮
    $(".lr .prev").click(function(){
		var $parent = $(this).parents(".lr");
		 var $v_show = $parent.find(".scrollGy"); 
		 var $v_content = $parent.find(".v_cont"); 
		 var v_width = $v_content.width() ;
		 var len = $v_show.find("li").length;
		 var page_count = Math.ceil(len / i) ; 
		 if( !$v_show.is(":animated") ){  
		 	 if( page == 1 ){ 
				$(this).stop();
			}else{
				$v_show.animate({ left : '+='+v_width }, 1000);
				page--;
			}
		}
    });					  


 
 
 
 
 
 
 
});
 
 
 
